﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lan.Repository.SqlSugar
{
    public class DbContext<T> where T : class, new()
    {
        public SqlSugarClient Db;
        public SimpleClient<T> CurrentDb { get { return new SimpleClient<T>(Db); } }
        //public 
        public DbContext()
        {
            string adress = "192.168.43.46";
            string port = "12350";
            string us = "aidoor";
            string pd = "123789";

            Db = new SqlSugarClient(new ConnectionConfig()
            {
                DbType = DbType.MySql,
                ConnectionString = $"Server=192.168.43.28;Port=3306;Database=Lan;Uid=root;Pwd=root;charset=utf8;allow zero datetime=true;sslmode=none",
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute
            });

        }
    }
}
